// import { Configuration } from 'webpack';
const merge = require('webpack-merge')
const webpackBaseConfig = require('./config/webpack.base.config')

/**
 * @type {Configuration}
 */
const config = {
  mode: 'development',
  optimization: {
    usedExports: true,
    minimize: true,
    splitChunks: {
      chunks: 'all',
      name: true,
      cacheGroups: {
        lodash: {
          name: "lodash",
          // test: /[\\/]node_modules[\\/]/, //打包第三方库
          test: (module) => { // 将应用基础库和特定依赖的库进行分离
            return /lodash/.test(module.context);
          },
          chunks: "all",
          priority: 10 // 优先级
        },
      }
    },
  },
  devtool: false,
  externals: {
    vue: 'Vue',
    // axios: 'axios',
    // 'vue-router': 'VueRouter',
    // 'axios': 'axios',
    // 'element-ui': 'Element',
  }
}

module.exports = merge(webpackBaseConfig, config)